<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8"/>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <title>医院管理-医院信息管理</title>

    <link href="../plugin/bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="../plugin/bootstrap-table-1.11.1/bootstrap-table.min.css" rel="stylesheet"/>
    <link href="../plugin/sweetalert-6.6.2/sweetalert2.min.css" rel="stylesheet"/>
    <link href="../plugin/jstree/jstree.min.css" rel="stylesheet">
    <!--  <link href="../css/main.css" rel="stylesheet" type="text/css"/>-->

    <script src="../plugin/jquery-3.2.1/jquery-3.2.1.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/js/bootstrap.min.js"></script>
    <script src="../plugin/bootstrap-table-1.11.1/bootstrap-table.js"></script>
    <script src="../plugin/bootstrap-table-1.11.1/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="../plugin/sweetalert-6.6.2/sweetalert2.min.js"></script>
    <script src="../plugin/jquery-3.2.1/jquery.formautofill.min.js"></script>
    <script src="../plugin/soul/utils3.js"></script>
    <script src='../js/base.js'></script>
    <script src="../js/distpicker.data.js"></script>
    <script src="../js/distpicker.js"></script>
    <script src="../plugin/jquery-3.2.1/jquery.serializejson.js"></script>
    <script src="../plugin/jstree/jstree.min.js"></script>

</head>

<body>

<script>
    $(function () {
        var resp = AjaxUtil.isLogin();
        if (!resp) return;
        var module = 'hospital';// 医院模块
        var myProvinces = provinceList;
        var myCitys='';
        var myDistricts='';
        var query = [{
            id: 'name',
            type: 'text',
            name: '医院名称',
            paramName: 'name',
            palceholder: ''
        }, {
            id: 'staffId',
            type: 'select',
            name: '医院负责人',
            paramName: 'staffId',
            items: 'staffManager/selectItem'
        }, {
            id: 'phone',
            type: 'text',
            name: '联系方式',
            paramName: 'phone',
            palceholder: ''
        }, ];
        var toolbar = {
            default: [false, true, true, true],// back;add;edit;remove
            dialog: [50, 2, 9],//对话框参数:模态框宽度(百分比);表单标题宽度;表单输入框宽度
            extra: []
        };
        var formElement = [{
            action: [false, true],
            type: 'hidden', // 表单类型
            name: 'hospitalId', // 字段名称
        },{
            action: [true, true],
            id:'province',
            type: 'select',
            label: '所属省份',
            name:'province',
            items: myProvinces,
        },{
            action: [true, true],
            id:'city',
            type: 'select',
            label: '所属城市',
            name:'city',
        },{
            action: [true, true],
            type: 'select',
            label: '所属区域',
            id: 'district',
            name:'district',
        },{
            action: [true, true],
            type: 'text',
            label: '名称',
            name: 'name',
        },{
            action: [true, true],
            id: 'staffId',
            name:'staffId',
            type: 'select',
            label: '医院负责人',
            items: 'staffManager/selectItem',
        },{
            action: [true, true],
            type: 'text',
            label: '联系方式',
            name: 'phone',
        },{
            action: [true, true],
            type: 'text',
            label: '服务周期',
            name: 'serviceCycle',
        },{
            action: [true, true],
            type: 'text',
            label: '服务内容',
            name: 'serviceContent',
        },{
            action: [true, true],
            type: 'text',
            label: '服务范围',
            name: 'serviceScope',
        },];

        var bootstrapTable = {
            url: '',
            columns: [{
                radio: true
            },{
                field: 'hospitalId',
                title: '医院编号',
                align: 'center',
            },{
                field: 'province',
                title: '所属省份',
                align: 'center',
            },{
                field: 'city',
                title: '所属城市',
                align: 'center',
            },{
                field: 'district',
                title: '所属区域',
                align: 'center',
            },{
                field: 'name',
                title: '医院名称',
                align: 'center',
            },{
                field: 'staffName',
                title: '医院负责人',
                align: 'center',
            },{
                field: 'phone',
                title: '联系方式',
                align: 'center',
            },{
                field: 'serviceCycle',
                title: '服务周期',
                align: 'center',
            },{
                field: 'serviceContent',
                title: '服务内容',
                align: 'center',
            },{
                field: 'serviceScope',
                title: '服务范围',
                align: 'center',
            },]
        }

        // debugger;
        hospital = SingleTablePageCreateUtil.createInstance(module, query, toolbar, formElement, bootstrapTable);


        hospital.onEditModalShowBefore = function (row) {
            $('#hospital_form_edit_city').text('');
            var a=ChineseDistricts[row.province];
            var s = '';
            for(var key in a){
                s+='<option value="'+a[key]+'">'+a[key]+'</option>';
            }
            $('#hospital_form_edit_city').append(s);
            $('#hospital_form_edit_district').text('');
            var w = '';
            var w1;
            for(var i in a){
                w1 = i;
                break;
            }
            var b=ChineseDistricts[w1];
            for(var j in b){
                w+='<option value="'+b[j]+'">'+b[j]+'</option>';
            }
            $('#hospital_form_edit_district').append(w);
            return row;
        };

        hospital.onAddModalShowBefore = function () {
            var optionStr = '<option value = "">请点击下拉框选择</option>';
            $('#hospital_form_add_city').html(optionStr);
            $('#hospital_form_add_district').html(optionStr);
            $('#hospital_modal_add input[name="name"]').val("");
            $('#hospital_modal_add input[name="phone"]').val("");
            $('#hospital_modal_add input[name="serviceCycle"]').val("");
            $('#hospital_modal_add input[name="serviceContent"]').val("");
            $('#hospital_modal_add input[name="serviceScope"]').val("");
            return true;
        };

        //增加模态框,当省份改变,所属城市跟着改变
        $('#hospital_form_add_province').change(function () {
            $('#hospital_form_add_city').text('');
            var a=ChineseDistricts[$('#hospital_form_add_province').val()];
            var s = '';
            for(var key in a){
                s+='<option value="'+a[key]+'">'+a[key]+'</option>';
            }
            $('#hospital_form_add_city').append(s);
            $('#hospital_form_add_district').text('');
            var w = '';
            var w1;
            for(var i in a){
                w1 = i;
                break;
            }
            var b=ChineseDistricts[w1];
            for(var j in b){
                w+='<option value="'+b[j]+'">'+b[j]+'</option>';
            }
            $('#hospital_form_add_district').append(w);

        });
        //增加模态框,当城市改变,所属区域跟着改变
        $('#hospital_form_add_city').change(function () {
            $('#hospital_form_add_district').text('');
            var a=ChineseDistricts[$('#hospital_form_add_city').val()];
            var s = '';
            for(var key in a){
                s+='<option value="'+a[key]+'">'+a[key]+'</option>';
            }
            $('#hospital_form_add_district').append(s);

        });

        //修改模态框,当省份改变,所属城市跟着改变
        $('#hospital_form_edit_province').change(function () {
            $('#hospital_form_edit_city').text('');
            var a=ChineseDistricts[$('#hospital_form_edit_province').val()];
            var s = '';
            for(var key in a){
                s+='<option value="'+a[key]+'">'+a[key]+'</option>';
            }
            $('#hospital_form_edit_city').append(s);
            $('#hospital_form_edit_district').text('');
            var w = '';
            var w1;
            for(var i in a){
                w1 = i;
                break;
            }
            var b=ChineseDistricts[w1];
            for(var j in b){
                w+='<option value="'+b[j]+'">'+b[j]+'</option>';
            }
            $('#hospital_form_edit_district').append(w);

        });
        //修改模态框,当城市改变,所属区域跟着改变
        $('#hospital_form_edit_city').change(function () {
            $('#hospital_form_edit_district').text('');
            var a=ChineseDistricts[$('#hospital_form_edit_city').val()];
            var s = '';
            for(var key in a){
                s+='<option value="'+a[key]+'">'+a[key]+'</option>';
            }
            $('#hospital_form_edit_district').append(s);

        });



    });
</script>

</body>

</html>